import { ApiProperty } from "@nestjs/swagger";
import { IsInt, IsNotEmpty, IsOptional } from "class-validator";
import { Type } from "class-transformer";

export class CreateTodoTaskDto {
    @ApiProperty({ example: '任务', description: '任务名称' })
    @IsNotEmpty({
        message: '任务名称不能为空'
    })
    name: string;

    @ApiProperty({ example: '任务描述', description: '任务描述' })
    @IsOptional()
    description: string;

    @ApiProperty({ example: '2024-01-01T10:00:00Z', description: '任务截止时间' })
    @IsOptional()
    endTime: Date;

    @ApiProperty({ example: '0', description: '优先级' })
    @IsOptional()
    priority: number;

    @ApiProperty({ example: '2024-01-01T10:00:00Z', description: '指派时间' })
    @IsOptional()
    assignTime: Date;

    @ApiProperty({ example: '指派人', description: '指派人' })
    @IsOptional()
    assignPerson: string;

    @ApiProperty({ example: '1', description: '所属用户' })
    @IsOptional()
    @Type(() => Number)
    @IsInt()
    userId: number;
}

export class DeleteTodoTaskDto {
    @ApiProperty({ example: 1, description: '任务ID' })
    @IsNotEmpty({
        message: 'ID不能为空'
    })
    @Type(() => Number)
    @IsInt()
    id: number
}

export class UpdateTodoTaskDto extends CreateTodoTaskDto {
    @ApiProperty({ example: 1, description: '任务ID' })
    @IsNotEmpty({
        message: 'ID不能为空'
    })
    @Type(() => Number)
    @IsInt()
    id: number

    @ApiProperty({ example: 0, description: '状态' })
    @IsOptional()
    @Type(() => Number)
    @IsInt()
    status: number;

    @ApiProperty({ example: '2024-01-01T10:00:00Z', description: '开始时间' })
    @IsOptional()
    startTime: Date;

    @ApiProperty({ example: '2024-01-01T10:00:00Z', description: '完成时间' })
    @IsOptional()
    finishTime: Date;

    @ApiProperty({ example: '取消原因', description: '取消原因' })
    @IsOptional()
    cancelReason: string;

    @ApiProperty({ example: '2024-01-01T10:00:00Z', description: '取消时间' })
    @IsOptional()
    cancelTime: Date;

}

export class FindManyTodoTaskDto { }